package com.itlong.cloud.operate.resource;

import com.itlong.cloud.POJO.DTO.operate.OperateUserManagePageDTO;
import com.itlong.cloud.POJO.VO.operate.OperateActiveUserVO;
import com.itlong.cloud.POJO.VO.operate.OperateUserManageVO;
import com.itlong.cloud.operate.service.IOperateUserManageService;
import com.itlong.cloud.user.operate.IOperateUserManageServiceClient;
import com.itlong.cloud.utils.page.Page;
import org.slf4j.Logger;import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      运营-APP用户-用户管理业务处理暴露接口实现类。
 * <desc/>
 *
 * @createDate 2017/9/21.
 */
@RestController
public class OperateUserManageServiceResource implements IOperateUserManageServiceClient {

    private static final Logger LOG = LoggerFactory.getLogger(OperateUserManageServiceResource.class);

   @Autowired
   IOperateUserManageService iOperateUserManageService;

    /**
     * <desc>
     *      根据用户ID获取用户详细信息。
     * <desc/>
     *
     * @param  userId 用户ID
     * @return  返回用户信息
     * @author shengen.T
     * @createDate 2017/9/22
     */
    @Override
    @RequestMapping(path = "/appUser/userManage/getUserInfo/{userId}")
    public OperateUserManageVO getUserInfo(@PathVariable(value = "userId") String userId){
        return  iOperateUserManageService.getUserInfo(userId);
    }

     /**
      * <desc>
      *      获取用户信息分页数据
      * <desc/>
      *
      * @param  pageDTO  请求参数
      * @return  返回用户信息列表
      * @author shengen.T
      * @createDate 2017/9/22
      */
     @Override
    @RequestMapping(path = "/appUser/userManage/getUserInfoPage")
    public Page<OperateUserManageVO> getUserInfoPage(@RequestBody OperateUserManagePageDTO pageDTO) throws Exception {
        return iOperateUserManageService.getPage(pageDTO);
    }

     /**
      * <desc>
      *     设置用户状态—启用/禁用。
      * <desc/>
      *
      * @param  userId 用户ID
      * @param  status 用户状态
      * @return
      * @author shengen.T
      * @createDate 2017/9/22
      */
    @Override
    @RequestMapping(path = "/appUser/userManage/setUserStatus/{userId}/{status}")
    public boolean setUserStatus(@PathVariable(value = "userId") String userId,@PathVariable(value = "status") Integer status) throws Exception {
        return iOperateUserManageService.setUserStatus(userId,status);
    }

    /**
     * <desc>
     *        根据查询条件查询今日/本周/本月的用户活跃度
     * </desc>
     *
     * @param timeFlag
     * @return
     * @Author Zhu.yj
     * @createDate  2019/10/31
     */
    @Override
    @RequestMapping(path = "/operate/project/getActiveUser")
    public OperateActiveUserVO getActiveUser(@RequestParam("timeFlag") String timeFlag ,
                                             @RequestParam("searchTime") String searchTime,
                                             @RequestParam("userId") String userId) throws Exception {
        return iOperateUserManageService.getActiveUser(timeFlag,searchTime,userId);
    }

    /**
     * <desc>
     *      查询注册用户量
     * </desc>
     *
     * @param
     * @return
     * @Author Zhu.yj
     * @createDate  2019/11/1
     */
    @Override
    @RequestMapping(path = "/operate/appUser/getPageCount")
    public String getPageCount() throws Exception {
        return iOperateUserManageService.getPageCount();
    }

}
